//
//  RecordedCostController.m
//  YongChuanTradingArea
//
//  Created by 李冰 on 2017/9/13.
//  Copyright © 2017年 李冰. All rights reserved.
//

#import "RecordedCostController.h"
#import "CustomKeyboard.h"
@interface RecordedCostController ()<CustomKeyboardDelegate>
@property (weak, nonatomic) IBOutlet UIView *allPriceView;
@property (weak, nonatomic) IBOutlet UIView *notJoinView;
@property (weak, nonatomic) IBOutlet UITextField *allPriceField;
@property (weak, nonatomic) IBOutlet UITextField *notJoinField;
@property (weak, nonatomic) IBOutlet UIView *keyboradView;

@end

@implementation RecordedCostController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = kBgColor;
    self.title = @"买单收银";
    
    _allPriceView.layer.cornerRadius = 5;
    _notJoinView.layer.cornerRadius = 5;
    
    CustomKeyboard *borad = [[CustomKeyboard alloc] initWithFrame:CGRectMake(0, 0, lbScreenWidth, AdaptationRatio(335))];
    [self.keyboradView addSubview:borad];
    borad.delegate = self;
    _allPriceField.inputView = [UIView new];
    _notJoinField.inputView = [UIView new];
}

- (void)buttonDidPress:(UIButton *)button index:(NSInteger)index {

    UITextField *field = nil;
    
    if (_allPriceField.isEditing) field = _allPriceField;
    if (_notJoinField.isEditing) field = _notJoinField;
    
    if (index == 3)
    {
        [field deleteBackward];
    }
    else if (index == 7)
    {
        field.text = @"";
    }
    else if (index == 11)
    {
    
    }
    else
    {
        [field insertText:button.titleLabel.text];
    }
    
}

@end
